import { GIF } from "../utils/gif";
import img1 from "../../image/GIF/1.gif";

export class A_GIFS{
    constructor(){
        this.animations = new Map();

        this.init_animations();
        
    }

    init_animations() {
        let outer = this;
        //let offsets = [0, -22, -22, -140, 0, 0, 0, 0, 60, 65];

        for (let i = 1; i <= 1; i++) {
            let gif = GIF();

            gif.load(`${img1}`);

            this.animations.set(i, {

                gif: gif,
                frame_cnt: 0,//总图片数量
                frame_rate: 10,//每10帧加载一次
                //offset_y: offsets[i],//yd方向偏移量
                loaded: false,//是否加载完整
                //scale: 2,//放大多少倍
            });

            gif.onload = function () {

                let obj = outer.animations.get(i);
                obj.frame_cnt = gif.frames.length;

                obj.loaded = true;
            }
        }
    }
}